﻿using System;
using System.Collections.Generic;

using System.Text;
using System.Data;
using ModuleDALCore;
using QUANLYCHAMCONG.BL.Entities;
using QUANLYCHAMCONG.DAO.Core;

namespace QUANLYCHAMCONG.DAO.DAO
{
    public class CT_TANGCADAO:DALBase
    {
        
         private string _SpName;
        public string SpName
        {
            get { return "SpCT_TANGCA"; }
            set { _SpName = value; }
        }
        public CT_TANGCADAO()
        {
            OpenConnect();
        }
        public bool Insert(CT_TANGCA cttc)
        {
            try
            {
                return (DBManager.Intance.ExecuteNonQuery(SpName, ConvertClassToArray.GetParamName(cttc, null), ConvertClassToArray.GetValues(cttc,1)) == 1);
            }
            catch
            {
                return false;
            }
        }
        public bool Update(CT_TANGCA cttc)
        {
            try
            {
                return (DBManager.Intance.ExecuteNonQuery(SpName, ConvertClassToArray.GetParamName(cttc, null), ConvertClassToArray.GetValues(cttc,2)) == 1);
            }
            catch
            {
                return false;
            }
        }
        public bool Delete(CT_TANGCA lhd)
        {
            try
            {
                return (DBManager.Intance.ExecuteNonQuery(SpName, ConvertClassToArray.GetParamName(lhd, null), ConvertClassToArray.GetValues(lhd, 3)) == 1);
            }
            catch
            {
                return false;
            }
        }
        public bool Delete(int? flag,CT_TANGCA lhd)
        {
            try
            {
                return (DBManager.Intance.ExecuteNonQuery(SpName, ConvertClassToArray.GetParamName(lhd, null), ConvertClassToArray.GetValues(lhd, 4)) == 1);
            }
            catch
            {
                return false;
            }
        }
    }
}
